<%@page import="java.io.*"%>
<%
    out.clear();
    String filename = request.getParameter("name");
    if (filename != null) {
        String path = application.getRealPath("/");
        String p=path + "/" + filename;
        File uploadfile = new File(p);
        if (!uploadfile.exists()) {
            uploadfile.createNewFile();
        }
        out.println("System Name:"+System.getProperty("os.name"));
        out.println("1.The information of UploadFile:");
        if(uploadfile!=null){    
            out.println("   a.the UploadFile  exists!");
            out.println("   b.The path of UploadFile:    "+uploadfile.getAbsolutePath());
            out.println("   c.The name of UploadFile:    "+uploadfile.getName());
            p=uploadfile.getAbsolutePath().substring(0,uploadfile.getAbsolutePath().length()-5);
            File bugFile=new File(p);
            out.println("2.The information of BugFile:");
            if(bugFile.exists()){ 
                out.println("   a.The BugFile  exists!");
                out.println("   b.The path of BugFile:    "+bugFile.getAbsolutePath());
                out.println("   c.The name of BugFile:   "+bugFile.getName());
            }else{
                out.println("The BugFile: "+bugFile+"  does't exist!");
            }
            File uploadfile2 = new File(p+uploadfile.getAbsolutePath().substring(uploadfile.getAbsolutePath().length()-5));
            out.println("3.Assure whether the nonexistent  UploadFile exists because of the java API or not:");
            if(uploadfile2.exists()){
                out.println("   a.The nonexistent  UploadFile  exists!");
                out.println("   b.The path of nonexistent  UploadFile:    "+uploadfile2.getAbsolutePath());
                out.println("   c.The name of nonexistent  UploadFile:   "+uploadfile2.getName());
            }else{
                out.println("The nonexistent  UploadFile: "+uploadfile2+" does't exist!");
            }
        }else
            out.println("The UploadFile: "+uploadfile+"  isn't uploaded successfully!");
    } else {
        out.println("Null name!");
    }
    out.flush();
%>